package designpattern.abstractfactory.factory;

import designpattern.abstractfactory.service.Color;
import designpattern.abstractfactory.service.Price;
import designpattern.abstractfactory.service.Shape;

public class PriceFactory extends AbstractFactory{
    @Override
    public Color getColor(Class<? extends Color> clazz) {
        return null;
    }

    @Override
    public Shape getShape(Class<? extends Shape> clazz) {
        return null;
    }

    @Override
    public Price getPrice(Class<? extends Price> clazz) {
        if (clazz == null){
            throw new RuntimeException("类路径不能为空");
        }
        Price price = null;
        try {
            price = (Price) clazz.newInstance();
        }catch (Exception e){
            e.printStackTrace();
            System.out.println(e.getMessage());
        }
        return price;
    }
}
